BIN=proc.exe
CC=gcc
#SRC=$(shell ls *.c)
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o) #把SRC里的.c文件换成.o文件
LFLAGS=-o #link连接时用到的选项
FLAGS=-c #编译时用到的选项
RM=rm -f

$(BIN):$(OBJ) #这里源文件依赖的就是.o文件
	@$(CC) $(LFLAGS) $@ $^ 
	@echo "$^ to $@, linking..." #linking连接
%.o:%.c #把所有源文件编译成同名.o文件
	@$(CC) $(FLAGS) $<
	@echo "$< to $@, compling..." #compling编译

.PHONY:clean
clean:
	@$(RM) $(BIN) $(OBJ)
	@echo "remove $(BIN) $(OBJ)..."

.PHONY:test
test:
	@echo $(SRC)
	@echo $(OBJ)
	


#BIN=myproc
#CC=gcc
#SRC=myproc.c
#OBJ=myproc.o # .o文件
#LFLAGS=-o #link连接时用到的选项
#FLAGS=-c #编译时用到的选项
#RM=rm -f
#
#$(BIN):$(OBJ) #这里源文件依赖的就是.o文件
#	@$(CC) $(LFLAGS) $@ $^ 
#	@echo "$^ to $@, linking..." #linking连接
#%.o:%.c #把所有源文件编译成同名.o文件
#	@$(CC) $(FLAGS) $<
#	@echo "$< to $@, compling..." #compling编译
#
#.PHONY:clean
#clean:
#	@$(RM) $(BIN) $(OBJ)
#	@echo "remove $(BIN),$(OBJ)..."




#BIN=myproc
#CC=gcc
#SRC=myproc.c
#FLAGS=-o
#RM=rm -f
#
#$(BIN):$(SRC)
#	@$(CC) $(FLAGS) $@ $^ 
#	@echo "$(SRC) to $(BIN), linking..."
#
#.PHONY:clean
#clean:
#	@$(RM) $(BIN)
#	@echo "remove $(BIN)..."
#
#.PHONY:test
#test:
#	@echo $(BIN)
#	@echo $(CC)
#	@echo $(SRC)
#	@echo $(FLAGS)




#myproc:myproc.o
#	gcc myproc.o -o myproc
#myproc.o:myproc.s
#	gcc -c myproc.s -o myproc.o
#myproc.s:myproc.i
#	gcc -S myproc.i -o myproc.s
#myproc.i:myproc.c
#	gcc -E myproc.c -o myproc.i
#
#.PHONY:clean
#clean:
#	rm -f *.i *.s *.o myproc



#myproc:myproc.c
#	gcc -o myproc myproc.c
#.PHONY:clean
#clean:
#	rm -f myproc
